package cn.shun.mapper;

import cn.shun.entity.Emp;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;


/**
 * <p>Project: MyBatis2023 - EmpMapper
 * <p>Powered by yishun On 2023-01-20 17:33:58
 *
 * @author yishun [2465734101@qq.com]
 * @version 1.0
 * @since 17
 */
@Mapper
public interface EmpMapper {

    //select
    List<Emp> selectList();
    List<Map<String,Object>> selectListMap();
    int count();
    String maxAge();



    @Select("select * from emp")
    List<Map<String, Object>> query();

    Emp queryById(int id);

    int update(Emp emp);
    int update(Map<String,Object> map);

    @Update("update empbak set age=age+#{age} where 1=1")
    int updates(double age);





    int add(
            @Param("name") String name,
            @Param("age") Integer age,
            @Param("job") String job,
            @Param("salary") Integer salary,
            @Param("entrydate") LocalDate entrydate,
            @Param("managerid") Integer managerid,
            @Param("dept_id") Integer dept_id);

    int insert(Map<String, Object> map);

    @Insert("insert into emp set id =#{id}, name=#{name}, age=#{age}, job=#{job}, salary=#{salary}, entrydate=#{entrydate}, managerid=#{managerid}, dept_id=#{dept_id}")
    int empSave(Emp emp);

    @Delete("delete from empbak where id =#{id}")
    int deleteById(Integer id);

    int deleteByIds(@Param("ids") int[] ids);

    int deleteByIdss(Map<String,Object> map);

    int deleteByNameLike(String name);
}
